home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news3.noc.netcom.net!zdc!zippo!usenet
- From: Jim McFarland <jgm6@orkand.em.cdc.gov>
- Subject: Re: DOS commands
- Content-Type: text/plain; charset=us-ascii
- Sender: usenet@news.zippo.com
- Content-Transfer-Encoding: 7bit
- Nntp-Posting-Host: 158.111.166.77
- Organization: The Orkand Corporation
- Message-ID: <DLDppy.Mt6@news.zippo.com>
- References: <30F6BED1.5E25@oak.westol.com>
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
- Mime-Version: 1.0
- Date: Thu, 18 Jan 1996 13:34:46 GMT
-
- Mark Kintigh <breetai@oak.westol.com> wrote:
- >wayneft@indirect.com wrote:
- >>
- >> I know that this is probably a stupid question, but it's been a while
- >> since I have programmed in C. My question is what is the command in a
- >> C program that executes a DOS command such as DIR, or COPY. I've
- >> looked through all my books and for some reason I just can't seem to
- >> find it. I know it is a real simple command that is in the dos.h
- >> header file. If someone could email me or post the command I would be
- >> very grateful, I need it because I have to something for work.
- >
- >There are two ways:
- > exec()
- > system()
- >Choose the one that suits you best!
-
- No, exec() won't work with "dir". Exec() functions only work with
- executables or batch files. The "dir" command does not have a
- corresponding.com or .exe. You must call system() to use "dir". To find
- out if you can use exec() to run a DOS command, make sure the command has
- a .com or .exe file in \dos.
-
- Jim
-
-